<template>
	<div class="container" ref="refContainer">
		<div class="doc-content">
			<div class="title">复选框说明文档</div>
			<div class="sub-title quote">
				复选框组件包含 checkbox、checkbox-group两个组件<br>
				你只需要引入CheckBox，即可使用两个组件
			</div>
			<div class="example-title">引入方式（按需）</div>
			<code-view>
				<template slot="code-js">{{ jsCode1 }}</template>
			</code-view>
			
			
			<div class="example-title">基本用法</div>
			<code-view>
				<template slot="code-html">{{ htmlCode2 }}</template>
				<template slot="code-js">{{ jsCode2 }}</template>
			</code-view>
			
			<div class="example-title">按钮样式</div>
				<code-view>
					<template slot="code-html">{{ htmlCode3 }}</template>
				</code-view>
			</Demo>
			
			<div class="example-title">&lt;gr-checkbox&gt;属性</div>
			<gr-table :width="800" :tableData="propertiesExplain1" textAlign="left">
				<template v-slot="{rowData}">
					<gr-table-column label="参数名称" width="100">
						{{rowData.attrName}}
					</gr-table-column>
					<gr-table-column label="参数说明" width="150">
						{{rowData.introduce}}
					</gr-table-column>
					<gr-table-column label="类型" width="140">
						{{rowData.type}}
					</gr-table-column>
					<gr-table-column label="可选值" width="60">
						{{rowData.optionValues}}
					</gr-table-column>
					<gr-table-column label="默认值" width="60">
						{{rowData.defaultValue}}
					</gr-table-column>
				</template>
			</gr-table>
			<div class="example-title">&lt;gr-checkbox-group&gt;属性</div>
			<gr-table :width="800" :tableData="propertiesExplain2" textAlign="left">
				<template v-slot="{rowData}">
					<gr-table-column label="参数名称" width="100">
						{{rowData.attrName}}
					</gr-table-column>
					<gr-table-column label="参数说明" width="150">
						{{rowData.introduce}}
					</gr-table-column>
					<gr-table-column label="类型" width="140">
						{{rowData.type}}
					</gr-table-column>
					<gr-table-column label="可选值" width="60">
						{{rowData.optionValues}}
					</gr-table-column>
					<gr-table-column label="默认值" width="60">
						{{rowData.defaultValue}}
					</gr-table-column>
				</template>
			</gr-table>
		</div>
		<div class="demo-view">
			<div ref="refCellPhone" class="cellphone">
				<iframe src="demo.html#/checkboxdemo" frameborder="0" width="100%" height="100%"></iframe>
			</div>
		</div>
	</div>
</template>

<script>
	import Demo from '../components/Demo.vue'
	import CodeView from '../components/CodeView.vue'
	export default {
		components: {
			Demo,
			CodeView
		},
		data() {
			return {
				checklist1: ['php'],
				checklist2: ['java'],
				jsCode1: `import {CheckBox} from 'gabriel-ui'
Vue.use(CheckBox)`,
				htmlCode2: `<gr-checkbox-group v-model="checklist">
	<gr-checkbox label="java">JAVA</gr-checkbox>
	<gr-checkbox label="python">Python</gr-checkbox>
	<gr-checkbox label="php">PHP</gr-checkbox>
	<gr-checkbox label="JS">JS</gr-checkbox>
</gr-checkbox-group>`,
				jsCode2: `export default {
	data() {
		return {
			checklist: ['php']
		}
	}
}`,
				htmlCode3: `<gr-checkbox-group v-model="checklist">
	<gr-checkbox button label="java">JAVA</gr-checkbox>
	<gr-checkbox button label="python">Python</gr-checkbox>
	<gr-checkbox button label="php">PHP</gr-checkbox>
</gr-checkbox-group>`,
				propertiesExplain1: [
					{
						attrName: 'label',
						introduce: `单个复选框的value`,
						type: 'String/Number/Boolen',
						optionValues: '----',
						defaultValue: '----'
					},
					{
						attrName: 'button',
						introduce: `是否为按钮样式`,
						type: 'Boolen',
						optionValues: 'true / false',
						defaultValue: 'false'
					}
				],
				propertiesExplain2: [
					{
						attrName: 'v-model',
						introduce: `复选框组的value值合集`,
						type: 'Array',
						optionValues: '----',
						defaultValue: '[]'
					}
				]
			}
		},
		mounted() {
			let ele = this.$refs.refCellPhone
			this.$refs.refContainer.addEventListener('scroll', (e)=> {
				ele.style.top = e.target.scrollTop + 'px';
			})
		}
	}
</script>

<style>
</style>
